const redis = require('redis');
require('dotenv').config();

// 创建 Redis 客户端
const redisClient = redis.createClient({
  url: `redis://:${process.env.REDIS_PASSWORD}@${process.env.REDIS_HOST}:${process.env.REDIS_PORT}`,
});

// 连接 Redis
redisClient.connect();

// 处理连接错误
redisClient.on('error', (err) => console.error('Redis Client Error', err));

module.exports = redisClient;